import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'

// 商品分类表实体，遵循 Asia/Shanghai 时区，UTF-8 编码
// 数据表：ug_category
@Entity('ug_category')
export class CategoryEntity {
  @PrimaryGeneratedColumn({ name: 'category_id', type: 'int' })
  categoryId: number

  @Index('idx_cat_parent')
  @Column({ name: 'parent_id', type: 'int', default: 0 })
  parentId: number

  @Column({ name: 'name', type: 'varchar', length: 50 })
  name: string

  @Column({ name: 'icon', type: 'varchar', length: 255, nullable: true })
  icon?: string

  @Column({ name: 'sort', type: 'int', default: 0 })
  sort: number

  @Column({ name: 'status', type: 'tinyint', default: 1 })
  status: number
}
